<%--
 *  File:    VisitProcessMainInfo.jsp
 *  @Author: liangchen
 *  Date:    2002/03/20
 *
 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<% //--------------------------------------  setting logger --%>
<%
  Category cat = Category.getInstance("jsp.VisitProcessMainInfo");
  //init param
  String strModuleName = "CRM";
  String privilegeCode = "H0252";
  String contextPath = request.getContextPath();
%>
<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/PageDefault.inc" %>

<html>
<head>
<PageFlow:CheckPageFlow pageName="p_visitprocessmain"/>
<%--@ include file="/inc/CatchError.inc" --%>
<%
  System.out.println("Trace \"isdefault\" ------- maininfo"+request.getParameter("isdefault"));
  String isDefault = request.getParameter("isdefault");
	String strIsDefault = null;
	String isTdNeed = "td_right";
	if("Y".equals(request.getParameter("isdefault"))) {
		strIsDefault = "&isdefault=Y";
		isTdNeed = "need";
	}else if ("N".equals(request.getParameter("isdefault"))) {
		strIsDefault = "&isdefault=N";
	}else  {
		strIsDefault = null;
	}
  HashMap visitprocessInfo = (HashMap)pageContext.getAttribute("visitprocessinfo");
  String isNew = request.getParameter("isNew");
  if("Y".equals(request.getParameter("isNew"))) {
		isNew = "Y";
	}else if ("N".equals(request.getParameter("isNew"))) {
		isNew = "N";
	}else  {
		isNew = null;
	}
  System.out.println("---"+visitprocessInfo);	
  if(visitprocessInfo == null)
	  visitprocessInfo = new HashMap();
  if(visitprocessInfo.get("createdate") == null)
	  visitprocessInfo.put("createdate",new java.sql.Date(System.currentTimeMillis()));
  HashMap userinfo = (HashMap)session.getAttribute("userinfo");
  String valueVisitprocessid = null;
  if(JspHelper.filterNull( visitprocessInfo.get("visitprocessid") )!= null) {
	  valueVisitprocessid = JspHelper.filterNull( visitprocessInfo.get("visitprocessid") ).toString();
  }else {
	  valueVisitprocessid = "";
  }
%>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="../css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="../js/FuncLib.js"></script>
<script language="JavaScript">





function changeStatus()
{
  if(form.status1.value == -1)
  {
	  form.valuename.value = " ";
  }
  else
  {
	  alert("status1 : " + form.status1.value);
    for (i = 0; i < form.status1.options.length; ++i)
    {
      var opt = form.status1.options[i];
      if (opt.selected)
      {
    	  form.valuename.value = opt.text;
      }
    }
  }
}

function changeProcessType()
{
  if(form.processtype1.value == -1)
  {
	  form.groupname.value = " ";
  }
  else
  {
    for (i = 0; i < form.processtype1.options.length; ++i)
    {
      var opt = form.processtype1.options[i];
      if (opt.selected)
      {
    	  form.groupname.value = opt.text;
      }
    }
  }
}

function page_save()
{
	if(isEmpty(form.processname.value)) {
		alert("<%= message.getMessageDesc("VALUE_NOT_NULL",label.getLabelName("L_VisitProcessCode",false)) %>");
		return;
	}
	if(isEmpty(form.comments.value)) {
		alert("<%= message.getMessageDesc("VALUE_NOT_NULL",label.getLabelName("L_Comments",false)) %>");
		return;
	}
	if(isEmpty(form.status.value)) {
		alert("<%= message.getMessageDesc("VALUE_NOT_NULL",label.getLabelName("L_Status",false)) %>");
		return;
	}
	<%System.out.println((String)pageContext.getAttribute("isdefault"));%>
	if( "Y" == "<%=isDefault%>") {
		if(isEmpty(form.processtype1.value)) {
		alert("<%= message.getMessageDesc("VALUE_NOT_NULL",label.getLabelName("L_Type",false)) %>");
		return;
		}
	}
	var frm = document.form;
	frm.actionname.value = "save";
	frm.target = "_parent";
	frm.submit();
}

function page_back()
{  
  parent.location.href = "VisitProcessSummary.jsp?<%= OvalTools.randomURL() %><%=JspHelper.filterNull(strIsDefault)%>&languagecode=<%= strLanguageCode%>";
}

function page_selectaction()
{
 var popwindow;
  var visitprocessid = document.form.visitprocessid.value;
  if(visitprocessid==null || visitprocessid==""){
     alert("<%= message.getMessageDesc("SAVE_INFO_FIRST") %>");
     return;
  }
  if(popwindow!=null)
    popwindow.close();
  var visitprocessid = document.form.visitprocessid.value;
  popwindow = window.open('<%=contextPath%>/devlop/sfe/VisitProcess4CustomerType.jsp?maxitem=12&languagecode=<%= strLanguageCode%>&<%= OvalTools.randomURL() %>&visitprocessid='+visitprocessid+'&info=Y','newwindow', 'height=400, width=850,top=150,left=300,toolbar=n0, menubar=no, scrollbars=auto, resizable=yes, location=no, status=no');
}
</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td class="summary_top"></td>
  </tr>
</table>
<table width="100%" cellspacing="0" cellpadding="0">
   <form name="form" method="post" action="../Dispatcher">
      <input type="hidden" name="pagename" value="p_visitprocessmain">
      <input type="hidden" name="actionname">

      <input type="hidden" name="languagecode" value="<%= strLanguageCode %>">

      <input type="hidden" name="createdate" value="<%= OvalTools.getDate() %>">
      <custom:hidden name ="visitprocessinfo" property="visitprocessid" value="<%=valueVisitprocessid%>"/>
      <oval:hidden property="userid" scope="session" changedName="maker" />
      <custom:hidden name="userinfo" property="orgid" scope="session" />
      <custom:hidden name="userinfo" property="orgname" scope="session" changedName="sellername" />
      <td valign="top">
        <table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" align="center" width="100%" cellpadding="1">
            
           
           <tr>
            <td colspan="4" class="deepblue-left" height="22"> <img src="../images/<%= strLanguageCode %>/quote.gif">
            &nbsp;
            </td>
          </tr>
          <tr>
          
          <td class="td_right" width="110" ><%= label.getLabelName("L_VisitProcessCode") + label.getLabelName("L_Colon") %></td>
          	<td>
          	<custom:write name="visitprocessinfo" property="processcode" nbsp="true"/>
           	</td>
           <td class="td_right" width="110" ><%= label.getLabelName("L_Status") + label.getLabelName("L_Colon") %></td>
          	<td>
				<custom:write  name="visitprocessinfo" property="statusname"  nbsp="true"/>
           	</td>
          </tr>
          
          <tr>
          <td class="td_right" width="110" ><%= label.getLabelName("L_VisitProcessName") + label.getLabelName("L_Colon") %></td>
          <td>
				<custom:write  name="visitprocessinfo" property="processname" />
           	</td>
           	<td class="td_right" width="110" ><%= label.getLabelName("L_CreateDate") + label.getLabelName("L_Colon") %></td>
           	<td>
           	
				<custom:write name="visitprocessinfo" property="createdate" dataType="date" dataFormatName="dateformat"/>
				
           	</td>
          </tr>
          <tr>
           	 <td class="td-text" width="110"  ><%= label.getLabelName("L_VisitProcessType")+ label.getLabelName("L_Colon") %></td>
          		<td>
				   <custom:write  name="visitprocessinfo" property="visitprotypename"  nbsp="true"/>
           	    </td>
          <td class="td-text" width="110" ><%= label.getLabelName("L_ForCustomerType") + label.getLabelName("L_Colon") %></td>
          		<td  >
				    <a onclick="page_selectaction()" ><custom:button type="1" label="L_Asterisk" imgsrc="back.gif" border="0"/></a>
           	    </td>
           	
          </tr>
		 <tr>
          <td class="td-text"width="110" ><%= label.getLabelName("L_Department") + label.getLabelName("L_Colon") %></td>
          <td colspan="3">
          <custom:write  property="deptnames"   nbsp="true" />
          </td>

          </tr>
           <tr>
          <td class="td-text"width="110" ><%= label.getLabelName("L_UserGroup") + label.getLabelName("L_Colon") %></td>
          <td colspan="3">
          <custom:write  property="usergroupnames" nbsp="true"  />
          </td>
          </tr>
           <tr>
           <td class="td_right" width="110" ><%= label.getLabelName("L_Comments") + label.getLabelName("L_Colon") %></td>
          <td colspan="3">
				<custom:write  name="visitprocessinfo" property="comments"  nbsp="true"/>
           	</td>
           </tr>
           
        </table>
      </td>
    </tr>
    <tr>
      <td class="summary_top"></td>
    </tr>
    <tr>
    <td height="49" class="td_center">
      <a onclick="javascript:page_back()"><custom:button type="1" label="L_Back" imgsrc="back.gif" border="0" style="width:60"/></a>
    </td>
    </tr>
</form>
</table>
<script language="JavaScript" src="../../js/Calendar.js" ></script>
<%@include file="/inc/AlertError.inc"%>
</body>
</html>


           		